package com.un.ebs.order.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.un.ebs.order.domain.OrderItemExt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * 2 Mapper 接口
 * </p>
 *
 * @author liubo
 * @since 2020-03-02
 */
@Component
public interface OrderItemExtMapper extends BaseMapper<OrderItemExt> {

    @SqlParser(filter = true)
    @Select("select isnull(sum(qty),0) from v_order_item_ext where spu_id=#{spuId} and submit_status=1")
    int queryCount(String spuId);

    @SqlParser(filter = true)
    @Select("select * from v_order_item_ext where order_id=#{id}")
    List<OrderItemExt> queryItemByOrderId(String id);
}
